package com.hooya.fa.eu.biz.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hooya.fa.eu.api.dto.PlInvoiceQueryDTO;
import com.hooya.fa.eu.biz.dao.entity.PlInvoice;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Description 1
 * @Author : Zongz
 * @Copyright Copyright (c) 豪雅集团
 * @Create 2023/12/6
 * @Version 1.0.0
 */
@Mapper
public interface PlInvoiceMapper extends BaseMapper<PlInvoice> {

    @Select("select * from pl_invoice where invoice_type = 'proforam' and create_time is null")
    List<PlInvoice> getErrorInvoiceType();

    @Select("SELECT * FROM pl_invoice where SUBSTR(create_time, 1, 10) = #{date}")
    List<PlInvoice> getByCreateTime(@Param("date") String date);

    @Select("select * from pl_invoice where sell_date >= #{startDate} and sell_date < #{endDate} " +
            "and sync_status = 2 and pl_invoice_id is not null and client_id is null")
    List<PlInvoice> getPlInvoicedListByDate(@Param("startDate") String startDate, @Param("endDate") String endDate);

    List<PlInvoice> getListByCondition(@Param("query") PlInvoiceQueryDTO query);

}
